package transform;

import org.apache.commons.lang.SerializationUtils;
import org.apache.kafka.common.header.Headers;
import org.apache.kafka.common.serialization.Deserializer;

import java.util.Map;

/**
 * @Author:RenPu
 * @Date: 2020/3/19 15:57
 * @Version: 1.0
 * @description:反序列化器
 */
public class UserDeSerializer implements Deserializer<User> {
    @Override
    public void configure(Map<String, ?> map, boolean b) {

    }

    @Override
    public User deserialize(String s, byte[] bytes) {

        //使用jdk自带的序列化工具类，进行将字节数组反序列化
        User user =(User) SerializationUtils.deserialize(bytes);
        return user;
    }

    @Override
    public User deserialize(String topic, Headers headers, byte[] data) {
        return null;
    }

    @Override
    public void close() {

    }
}
